<nz-modal [(nzVisible)]="isVisible" [nzWidth]="modalWidth" (nzOnCancel)="onBack()">
  <div *nzModalTitle>{{ title }}</div>
  <ng-container *nzModalContent>
    <form [formGroup]="dormitoryAllocationForm" (keydown.enter)="$event.preventDefault()">
      <nz-row [nzGutter]="10">
        <nz-col [nzSpan]="12">
          <nz-form-item>
            <nz-form-label [nzSpan]="6" nzFor="roomNumber" nzRequired>房间号</nz-form-label>
            <nz-form-control [nzErrorTip]="'请选择房间号'">
              <nz-input-group nzSearch [nzAddOnAfter]="roomNumberSuffixIconButton">
                <input nz-input formControlName="roomNumber" placeholder="请选择房间号" readonly />
              </nz-input-group>
              <ng-template #roomNumberSuffixIconButton>
                <button nz-button nzType="primary" nzSearch (click)="findDormitoryRoom()"><nz-icon nzType="search" /></button>
              </ng-template>
            </nz-form-control>
          </nz-form-item>
        </nz-col>
        <nz-col [nzSpan]="12">
          <nz-form-item>
            <nz-form-label [nzSpan]="6" nzFor="studentName" nzRequired>学生姓名</nz-form-label>
            <nz-form-control [nzErrorTip]="'请选择学生姓名'">
              <nz-input-group nzSearch [nzAddOnAfter]="studentNameSuffixIconButton">
                <input nz-input formControlName="studentName" placeholder="请选择学生姓名" readonly />
              </nz-input-group>
              <ng-template #studentNameSuffixIconButton>
                <button nz-button nzType="primary" nzSearch (click)="findStudent()"><nz-icon nzType="search" /></button>
              </ng-template>
            </nz-form-control>
          </nz-form-item>
        </nz-col>
      </nz-row>
    </form>
  </ng-container>
  <div *nzModalFooter>
    <div class="form-button-container">
      <button nz-button nzType="primary" (click)="onSave()" [nzLoading]="saveLoading">保存</button>
      <button nz-button nzType="default" (click)="onReset()" [nzLoading]="saveLoading">重置</button>
      <button nz-button nzType="default" (click)="onBack()">关闭</button>
    </div>
  </div>
</nz-modal>
<dormitory-room-selector (dormitoryRoomSelectedEvent)="handleDormitoryRoomSelectedEvent($event)"></dormitory-room-selector>
<student-selector (studentSelectedEvent)="handleStudentSelectedEvent($event)"></student-selector>
